package esempio.domain;

import java.util.HashSet;
import java.util.Set;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinTable;
import javax.persistence.OneToMany;
import javax.persistence.JoinColumn;
import javax.persistence.Table;



@Entity
@Table(name="CLIENT")
public class Client {
	private long clientId;
	private String firstname;
	private String lastname;
	private String mail;
	private String telephone;
	private String adress;
	private Set<Request> requests = new HashSet<Request>(0);
	
	
	public Client(String firstname, String lastname, String mail,
			String telephone, String adress, Set<Request> requests) {
		
		this.firstname = firstname;
		this.lastname = lastname;
		this.mail = mail;
		this.telephone = telephone;
		this.adress = adress;
		this.requests = requests;
	}


	public Client() {	}
	@Id
	@GeneratedValue
	@Column(name="CLIENT_ID")
	public long getClientId() {
		return clientId;
	}

	public void setClientId(long clientId) {
		this.clientId = clientId;
	}
	@Column(name="FIRST_NAME")
	public String getFirstname() {
		return firstname;
	}

	public void setFirstname(String firstname) {
		this.firstname = firstname;
	}
	@Column(name="LAST_NAME")
	public String getLastname() {
		return lastname;
	}

	public void setLastname(String lastname) {
		this.lastname = lastname;
	}
	@Column(name="MAIL")
	public String getMail() {
		return mail;
	}

	public void setMail(String mail) {
		this.mail = mail;
	}
	@Column(name="TELEPHONE")
	public String getTelephone() {
		return telephone;
	}

	public void setTelephone(String telephone) {
		this.telephone = telephone;
	}
	@Column(name="ADRESS")
	public String getAdress() {
		return adress;
	}

	public void setAdress(String adress) {
		this.adress = adress;
	}

	@OneToMany(cascade = CascadeType.ALL)
	@JoinTable(name = "CLIENT_REQUEST",joinColumns = {@JoinColumn(name = "CLIENT_ID") }, inverseJoinColumns = { @JoinColumn(name = "REQUEST_ID") })
	public Set<Request> getRequests() {
		return requests;
	}

	public void setRequests(Set<Request> requests) {
		this.requests = requests;
	}
	
	

}
